package connection;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.ResourceBundle;

public class DBConnection {
	ResourceBundle properties = ResourceBundle.getBundle("controller.string");
	String connURL = properties.getString("ConnURL");
	String user = properties.getString("DBUser");
	String passwort = properties.getString("DBPasswort");
	private static DBConnection dbc;
	
		Connection con;
		private DBConnection(){
			
		}
		
		public static synchronized DBConnection getDBConnection(){
			if(dbc == null){
				dbc = new DBConnection();
			}
			
			return dbc;
		}
		
		public Object clone() throws CloneNotSupportedException{
			throw new CloneNotSupportedException();
		}
		public Connection getDBInfos() throws SQLException{
		try {
			Class.forName("com.mysql.jdbc.Driver");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		con = DriverManager.getConnection(connURL, user, passwort);
		return con;
		}
		
	

}
